<template>
    <div>
        <form>
            <div class="form-group">
                <label>用户名</label>
                <input class="form-control" placeholder="用户名" v-model="name">
            </div>
            <div class="form-group">
                <label>手机号</label>
                <input class="form-control" placeholder="手机号" v-model="phone">
            </div>
            <button type="button" class="btn btn-default" @click="saveSession">保存到session</button>
            <router-link to="/test2" type="button" class="btn btn-default">获取session的值</router-link>
        </form>

    </div>
</template>
<script>
    import axios from 'axios'

    export default {
        data() {
            return {
                name: '',
                phone: ''
            }
        },
        methods: {
            saveSession() {
                let url = this.NW_API_API_LOCALE_VERSION +"/test/save"
                let params = new URLSearchParams();
                params.append("name", this.name)
                params.append("phone", this.phone)
                this.xurl.post(url, params).then(data => {
                    console.log("save to session success is :" + data.success)
                })
            }
        },
        components:{
            "goods-detail":()=>import("../pages/store/components/goods/GoodsDetail"),
        }
    }

</script>
<style scoped>

</style>
